package demo;

public class Main {
    static MyBinaryTree myBinaryTree = new MyBinaryTree();


    public static void main(String[] args) {
        MyBinaryTree.TreeNode tree = myBinaryTree.creatTree();

        myBinaryTree.preOrderNor(tree);
        System.out.println();
        myBinaryTree.preOrder(tree);
        System.out.println();

        myBinaryTree.inOrderNor(tree);
        System.out.println();
        myBinaryTree.inOrder(tree);
        System.out.println();

        myBinaryTree.postOrderNor(tree);
        System.out.println();
        myBinaryTree.postOrder(tree);
        System.out.println();
    }

    public static void main2(String[] args) {
        MyBinaryTree.TreeNode tree = myBinaryTree.creatTree();
        System.out.println("节点个数：" + myBinaryTree.size(tree));
        System.out.println("叶子节点个数：" +
                myBinaryTree.getLeafNodeCount(tree));
        int k = 5;
        System.out.println("第" + k + "层节点的个数：" +
                myBinaryTree.getKLevelNodeCount(tree, k));
        System.out.println("树的深度" + myBinaryTree.getHeight(tree));
        char key = 'A';
        MyBinaryTree.TreeNode find = myBinaryTree.find(tree, key);
        if(find == null) {
            System.out.println("未找到");
        } else {
            System.out.println(key + " 找到了 " + find);
        }
    }
    public static void main3(String[] args) {
        MyBinaryTree.TreeNode tree = myBinaryTree.creatTree();
        myBinaryTree.levelOrder(tree);
        System.out.println(myBinaryTree.isCompleteTree(tree));

    }
    public static void main1(String[] args) {
        MyBinaryTree.TreeNode root = myBinaryTree.creatTree();
        System.out.println("-----");
        myBinaryTree.preOrder(root);
        System.out.println();
        System.out.println("-----");
        myBinaryTree.inOrder(root);
        System.out.println();
        System.out.println("-----");
        myBinaryTree.postOrder(root);
        System.out.println();
    }
}
